package ext.tianma.bom.service;

import java.io.File;
import java.io.IOException;

import wt.util.WTProperties;

public class MyConstants {

	public static final String DESIGN_VIEW = "Design";
	public static final String XML_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n";
	public static final String XML_EXTENSION = ".xml";
	public static final String COMMA_SEPARATOR = ",";
	public static final String SUCCESS = "SUCCESS";
	public static final String FAILED = "FAILED";
	public static String WTHOME_DIR = "";
	public static String CODEBASE_DIR = "";
	public static String TEMP_DIR = "";
	public static String DRAWING_DIR = "";
	public static String ECN_DIR = "";

	public static String ERP_ECN_DIR = ""; // ERP ecn share folder
	public static String ERP_DRAWING_DIR = ""; // ERP drawing share folder

	static {
		try {
			WTProperties props = WTProperties.getLocalProperties();
			WTHOME_DIR = props.getProperty("wt.home");
			CODEBASE_DIR = props.getProperty("wt.codebase.location");
			TEMP_DIR = props.getProperty("wt.temp");

			ECN_DIR = TEMP_DIR + File.separator + "ecnnotice" + File.separator;
			File ecnDir = new File(ECN_DIR);
			if (!ecnDir.exists()) {
				new File(ECN_DIR).mkdirs();
			}

			DRAWING_DIR = CODEBASE_DIR + File.separator + "temp" + File.separator + "drawing" + File.separator;
			File drawingDir = new File(DRAWING_DIR);
			if (!drawingDir.exists()) {
				new File(DRAWING_DIR).mkdirs();
			}

			File erpECNDir = new File(ERP_ECN_DIR);
			if (!erpECNDir.exists()) {
				new File(ERP_ECN_DIR).mkdirs();
			}

			File erpDrawingDir = new File(ERP_DRAWING_DIR);
			if (!erpDrawingDir.exists()) {
				new File(ERP_DRAWING_DIR).mkdirs();
			}
		} catch (IOException e) {
			e.printStackTrace();
		}

	}
}
